// This file is part of MatrixPilot.
//
//    http://code.google.com/p/gentlenav/
//
// Copyright 2009, 2010 MatrixPilot Team
// See the AUTHORS.TXT file for a list of authors of MatrixPilot.
//
// MatrixPilot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// MatrixPilot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with MatrixPilot.  If not, see <http://www.gnu.org/licenses/>.


// Definition of different autopilot output controls.
// A union of structure and array is defined for ease of data access.
// Different definitions for different airframes types are placed in union

#ifndef CONTROL_DEFINES_H
#define CONTROL_DEFINES_H

typedef struct tagWaggSettings
{
	unsigned int waggleYawControl		: 1;
	unsigned int wagglePitchControl		: 1;
	unsigned int waggleRollControl		: 1;
	unsigned int waggleUnused			: 13;
} WAGGLE_SETTINGS;

extern const WAGGLE_SETTINGS waggleSettings;

typedef enum
{
	APCON_PITCH = 0,
	APCON_ROLL,
	APCON_YAW,
	APCON_THROTTLE,
	APCON_BRAKES,
	APCON_FLAPS,
	APCON_CAMBER,
	APCON_MAX_COMMANDS,		// Must be at the end of the longest list.
} APNormalControls;


typedef struct tagNORMALCONTROLS
{
	int pitch_control;
	int roll_control;
	int yaw_control;
	int throttle_control;
	int airbrake_control;
	int flap_control;
	int camber_control;
} NORMALCONTROLS;


typedef struct tagHELICONTROLS
{
	int pitch_control;
	int roll_control;
	int nick_control;
	int altitude_control;
	int vector_control;
	int aux2_control;
	int aux3_control;
} HELICONTROLS;


typedef enum
{
	APCON_HELI_PITCH = 0,
	APCON_HELI_ROLL,
	APCON_HELI_NICK,		// aka. yaw
	APCON_HELI_ALTITUDE,
	APCON_HELI_VECTOR,		// For verticopter style vectoring and similar
} APHeliControls;


typedef int CONTROL_ARRAY[APCON_MAX_COMMANDS];

// Here is the union used to place all of the controls
typedef union
{
	NORMALCONTROLS  normalControls;
	HELICONTROLS	heliControls;
	CONTROL_ARRAY	controlArray;
} APCONTROLS;

extern APCONTROLS autopilot_controls;

#endif
